import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    loginUserInfor: JSON.parse(localStorage.getItem('loginUserInfor')) || {}
  },
  mutations: {
    setLoginUserInfor: (state, loginUserInfor) => {
      state.loginUserInfor = loginUserInfor
      localStorage.setItem('loginUserInfor', JSON.stringify(loginUserInfor))
    }
  },
  getters: {
  },
  actions: {
    commitLoginUserInfor: ({commit}, loginUserInfor) => {
      commit('setLoginUserInfor', loginUserInfor)
    }
  }
})
